x86: use EFI calling convention for efi_main on x86_64
authorIvan Gorinov <[email protected]>
Thu, 14 Jun 2018 00:27:39 +0000 (17:27 -0700)
committerBin Meng <[email protected]>
Sun, 17 Jun 2018 13:16:04 +0000 (21:16 +0800)
commit9f0b0113c975d08c7fc5a509d67f128515486c0c
tree66bd88546ee2ca7e88652eb1de31c11e3f014952
parente3ec0d03bb1df69e8c9aba3eebba0690dc8e538b
x86: use EFI calling convention for efi_main on x86_64

UEFI specifies the calling convention used in Microsoft compilers;
first arguments of a function are passed in (%rcx, %rdx, %r8, %r9).

All other compilers use System V ABI by default, passing first integer
arguments of a function in (%rdi, %rsi, %rdx, %rcx, %r8, %r9).

These ABI also specify different sets of registers that must be preserved
across function calls (callee-saved).

GCC allows using the Microsoft calling convention by adding the ms_abi
attribute to a function declaration.

Current EFI implementation in U-Boot specifies EFIAPI for efi_main()
in the test apps but uses default calling convention in lib/efi.

Save efi_main() arguments in the startup code on x86_64;
use EFI calling convention for _relocate() on x86_64;
consistently use EFI calling convention for efi_main() everywhere.

Signed-off-by: Ivan Gorinov <[email protected]>
Reviewed-by: Alexander Graf <[email protected]>
Reviewed-by: Bin Meng <[email protected]>
Tested-by: Bin Meng <[email protected]>
arch/x86/lib/crt0_x86_64_efi.S
lib/efi/efi_app.c
lib/efi/efi_stub.c